package com.qqt.csr.common.mongo;

import cn.hutool.core.date.DateUtil;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.WritingConverter;

import java.util.Date;

@WritingConverter
public class DateToStringConverter implements Converter<Date, String> {
    @Override
    public String convert(Date source) {
        return source== null ? null : DateUtil.formatDateTime(source);
    }
}
